package com.rshy.cloud.bamboo.comm.basic.spring.ribbon;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.netflix.loadbalancer.RoundRobinRule;
import com.netflix.loadbalancer.Server;

public class IRoundRobinRule extends RoundRobinRule {
	/**
	 * 日志对象
	 */
	public final Logger logger = LoggerFactory.getLogger(getClass());

	@Override
	public Server choose(Object key) {
		Server server = super.choose(key);
		String hostPort = server.getHostPort();
		logger.info(String.format("访问目标机器地址为： %s", hostPort));
		return server;
	}
}
